package boot.spring.controller;

import boot.spring.entity.Clock;
import boot.spring.entity.Department;
import boot.spring.service.ClockService;
import boot.spring.service.DepartmentService;
import boot.spring.util.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/*签到管理页面的控制层*/
@RequestMapping("/SigninmanagementController")
@RestController
public class SigninmanagementController {
    @Autowired/*注入部门表的业务层*/
    private DepartmentService departmentService;

    @Autowired/*注入打卡表的业务层*/
    private ClockService clockService;



    @RequestMapping("/DepConAlltime")/*获取用户的上下班时间*/
    public Department DepConAlltime(Integer uid) {
        return departmentService.DepSerAlltime(uid);
    }

    @GetMapping("/ClockConAlltime")/*根据用户id以及当前时间查询用户是否打卡签到*/
    public Result ClockConAlltime(Clock alltime){
        return clockService.ClockSerAlltime(alltime);
    }
    @PostMapping("/ClockConAdd")/*修改用户签到数据*/
    public Result ClockConAdd(Clock add){
        return clockService.ClockSerAdd(add);
    }
    @PostMapping("/ClockConUp")
    public Result ClockConUp(Clock up){
        return clockService.ClockSerUp(up);
    }

}
